<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      py:strip="">

  <py:match path="head" once="true"><head>
    <title>Administration: ${select('title/text()')}</title>
    ${select("*[local-name() != 'title']")}
  </head></py:match>

  <py:match path="body" once="true" buffer="false"><body>
    <div id="content" class="admin">
      <h1>Administration</h1>
      <div id="tabs">
        <ul py:for="category, panels in groupby(panels, lambda p: p.category)"
            py:with="cat_is_active = category.id == active_cat">
          <li class="${cat_is_active and 'active' or None}">
            ${category.label}
            <ul>
              <li py:for="panel in panels" py:with="panel = panel.panel;
                      pan_is_active = cat_is_active and panel.id == active_panel"
                  class="${pan_is_active and 'active' or None}">
                <a href="${href.admin(category.id, panel.id)}">${panel.label}</a>
              </li>
            </ul>
          </li>
        </ul>
      </div>
      <div id="tabcontent">
        ${select("*|text()")}
        <br style="clear: right" />
      </div>
    </div>

  </body></py:match>

  <xi:include href="layout.html" />
</html>
